package com.qf.shop.service.impl;

import com.qf.shop.dao.Impl.ManagerDaoImpl;
import com.qf.shop.dao.ManagerDao;
import com.qf.shop.entity.Manager;
import com.qf.shop.service.ManagerService;
import com.qf.shop.utils.DruidUtils;

public class ManagerServiceImpl implements ManagerService {
    @Override
    public Manager login(String username, String password) {
        ManagerDao managerDao = new ManagerDaoImpl();
        Manager manager = null;

        try {
            DruidUtils.begin();

            Manager select = managerDao.select(username);
            if(select!=null){
                if(select.getPassword().equals(password)){
                    manager = select;
                }
            }
            DruidUtils.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return manager;
    }
}
